home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5776 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  35 lines

  1. Path: news.telepac.pt!usenet
  2. From: jcarlosr@mail.telepac.pt (J.Carlos)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Life is strange, especially with Watcom
  5. Date: Tue, 06 Feb 1996 19:49:18 GMT
  6. Organization: telepac
  7. Message-ID: <4f8f1h$8a3@vivaldi.telepac.pt>
  8. References: <DLxtH3.AMA.0.-s@cs.vu.nl>
  9. NNTP-Posting-Host: alv1_p7.telepac.pt
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. alverste@cs.vu.nl (Andre Versteeg) wrote:
  13. >I have trouble with the difference between C and C++ with Watcom 10.0:
  14. >I have a library with the following function in the .H header file:
  15. >int Setup(void)
  16. >With this library came a .C example file which used this function as follows:
  17. >int v;
  18. >v = Setup();
  19. >All compiles very well, until I changed the code to:
  20. >int v = Setup(); and changed the filename to .CPP
  21. >Now the compiler screams the following:
  22. >* Undefined reference: int near Setup(void)
  23. >Can somebody offer a solution ? I'm not allowed to change the library...
  24.  
  25. The problem is that the compiler is searching for the function Setup
  26. as a C++ function (with name mangling), but Setup is a C function so
  27. you must change the declaration in the .H file to :
  28.  
  29. extern "C" int Setup(void)
  30.  
  31. Regards, J.Carlos
  32. jcarlosr@mail.telepac.pt
  33.  
  34.  
  35.